#include<iostream>
#include<arbb.hpp>
#include<stdio.h>
#include<cstdlib>
#include<sys/time.h>
#include "GRMAT.h"
#define VERTICES 6
using namespace arbb;

void DFS(Graph* G, i32 v)
{
  G->setMark(v, VISITED);
  cout<<"vertex: "<<value(v)<<endl;
  for (i32 w=G->first(v); w<G->n();
       w = G->next(v,w))
    if (G->getMark(w) == UNVISITED) 
      call(DFS)(G, w);
};

int main()
{
  //  i32 VERTICES=6;
  i32 start=0;
  Graphm G(VERTICES);
  for(int i=0;i<VERTICES;i++)
    {
      for(int j=0;j<VERTICES;j++)
	{
	  G.setEdge(i,j,0);
	}
    }
  G.setEdge(0,2,1);
  G.setEdge(0,4,1);
  G.setEdge(1,2,1);
  G.setEdge(1,5,1);
  G.setEdge(2,0,1);
  G.setEdge(2,1,1);
  G.setEdge(2,3,1);
  G.setEdge(2,5,1);
  G.setEdge(3,2,1);
  G.setEdge(3,5,1);
  G.setEdge(4,0,1);
  G.setEdge(4,5,1);
  G.setEdge(5,1,1);
  G.setEdge(5,2,1);
  G.setEdge(5,3,1);
  G.setEdge(5,4,1);
  timeval tim;
  gettimeofday(&tim, NULL);
  double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
  //Algorithm
  call(DFS)(&G,start);
  //End of Algorithm
  gettimeofday(&tim, NULL);
  double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
  printf("%.6lf seconds elapsed\n", t2-t1);
  return 0;
}
